
* CLEAN LABELS FOR OCCUPATIONAL CLASSIFICIATION OF 1980

use "Data/gb91co80/CAMSIS/Web/New/downloads/gb/gb91co80.dta", clear

duplicates drop co80 , force
drop if co80==.

keep co80str opcod co80

format  opcod %80.0g
sort co80

********************************************************************************
* Code categories
********************************************************************************

ge JobArea=.
replace JobArea=2 if co80<19
replace JobArea=1 if co80>=19 & co80<23
replace JobArea=6 if co80==23.01
replace JobArea=1 if co80==23.02
replace JobArea=2 if co80>=24 & co80<40
replace JobArea=0 if co80>=40 & co80<41
replace JobArea=6 if co80>=41 & co80<43
replace JobArea=2 if co80>=43 & co80<45 
replace JobArea=4 if co80>=45 & co80<47
replace JobArea=3 if co80>=47 & co80<48
replace JobArea=4 if co80>=48 & co80<51
replace JobArea=3 if co80>=51 & co80<58
replace JobArea=6 if co80>=58 & co80<60
replace JobArea=3 if co80>=60 & co80<76
replace JobArea=0 if co80>=76 & co80<84
replace JobArea=5 if co80>=84 & co80<91
replace JobArea=7 if co80>=91 & co80<93
replace JobArea=5 if co80>=93 & co80<102
replace JobArea=7 if co80>=102 & co80<103
replace JobArea=5 if co80>=103 & co80<130
replace JobArea=7 if co80>=130 & co80<131
replace JobArea=5 if co80>=131 & co80<147
replace JobArea=3 if co80>=147 & co80<159
replace JobArea=5 if co80>=159 & co80<161

label define jobco80 0 "Farming" 1 "Artistic and Creative" 2 "Professional, technical" 3 "Service" 4 "Clearical" 5 "Manual (ind)" 6 "Armed forces and sporting" 7 "Craftspersons" 

********************************************************************************
* Finish up
********************************************************************************

keep co80str JobArea  opcod
save scratchdata/co80labeles.dta, replace

duplicates drop opcod, force
sort opcod
save scratchdata/co80labelesug.dta, replace

